import requests
from config import url, headers_web,headers_wechat

class AttendanceActivities:
    def __int__(self):
        self.url = url
        self.headers = headers_web
        self.headers = headers_wechat

    @classmethod
    def get_exportattendancestudents(cls,url:str,params=None,headers=headers_web,paramspath=None):
        '''
        @Summary:老师导出考勤活动详情
        @Description:云课堂老师端导出考勤活动详情
        :param url:
        :param params:
        :return:
        '''
        url = url + f"/teachingApi/v1/attendanceactivities/{paramspath}/exportattendancestudents"
        r = requests.get(url=url,headers=headers,params=params)
        return r

    @classmethod
    def post_attendanceStatus(cls,url:str,params=None,headers=headers_web,json=None,paramspath=None):
        '''
        @Summary:更新考勤活动状态
        @Description:互动课堂考勤活动使用
        :param url:
        :param params:
        :param json:
        :return:
        '''
        url = url + f"/teachingApi/v1/attendanceactivities/{paramspath}/attendanceStatus"
        r = requests.post(url=url, headers=headers, params=params,json=json)
        return r

    @classmethod
    def get_attendance(cls, url: str, params=None,headers=headers_web,paramspath=None):
        '''
        @Summary:老师查看考勤活动详情
        @Description:老师查看考勤活动详情
        :param url:
        :param params:
        :return:
        '''
        url = url + f"/teachingApi/v1/attendanceactivities/{paramspath}"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def post_retroactive(cls, url: str, params=None,headers=headers_web, json=None,paramspath=None):
        '''
        @Summary:互动课堂补签
        @Description:互动课堂考勤活动使用
        :param url:
        :param params:
        :param json:
        :return:
        '''
        url = url + f"/teachingApi/v1/attendanceactivities/{paramspath}/retroactive"
        r = requests.post(url=url, headers=headers, params=params, json=json)
        return r

    @classmethod
    def post_registration(cls, url: str, params=None,json=None,headers=headers_wechat,paramspath=None):
        '''
        @Summary:用户签到
        @Description:小程序考勤活动使用
        :param url:
        :param params:
        :param json:
        :return:
        '''
        url = url + f"/teachingApi/v1/attendanceactivities/{paramspath}/registration"
        r = requests.post(url=url, headers=headers, params=params, json=json)
        return r

    @classmethod
    def get_attendancedetails(cls, url: str, params=None,headers=headers_web,paramspath=None):
        '''
        @Summary:获取考勤活动的学生及其考勤情况
        @Description:互动课堂考勤活动使用
        :param url:
        :param params:
        :return:
        '''
        url = url + f"/teachingApi/v1/attendanceactivities/{paramspath}/attendancedetails"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def get_currentactivity(cls, url: str, headers=headers_wechat,params=None):
        '''
        @Summary:获取进行中的考勤信息
        @Description:小程序端观看直播时调用
        :param url:
        :param params:
        :return:
        '''
        url = url + "/teachingApi/v1/attendanceactivities/currentactivity"
        r = requests.get(url=url, headers=headers, params=params)
        return r

    @classmethod
    def post_attendanceactivities(cls, url: str, params=None,headers=headers_web, json=None):
        '''
        @Summary:创建考勤活动
        @Description:互动课堂考勤活动使用
        :param url:
        :param params:
        :param json:
        :return:
        '''
        url = url + "/teachingApi/v1/attendanceactivities"
        r = requests.post(url=url, headers=headers, params=params, json=json)
        return r

    @classmethod
    def get_attendanceactivities(cls, url: str,headers=headers_wechat, params=None):
        '''
        @Summary:获取考勤活动列表
        @Description:1.小程序老师端获取考勤活动列表
        :param url:
        :param params:
        :return:
        '''
        url = url + "/teachingApi/v1/attendanceactivities"
        r = requests.get(url=url, headers=headers, params=params)
        return r

if __name__ == '__main__':
    param = {"validCode":"5c75026f02a78a71d3d6c6250602201f"}
    urll = "http://192.168.1.26:8080/teachingApi/v1/attendanceactivities/4028811d88892ba10188aee1242c04a8/attendancedetails"
    r = AttendanceActivities.get_attendancedetails(url=urll,params=param,headers=headers_web)
    print(r)
    print(r.content)